package com.web.Controller;

import org.apache.log4j.Logger;

import com.web.model.*;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Page;

public class HomeController extends Controller{
	private static Logger logger = Logger.getLogger(HomeController.class);
	public void index() {
		
		int pageIndex = this.getParaToInt("p", 1);
		Page<UsersModel> page = UsersModel.dao.paginate(pageIndex, 10, "select * ", " from users  where id>? order by id desc",100 );
		setAttr("list", page.getList());
		setAttr("page", page);
		render("/home/index.html");
	}
	public void detail() {
		int idValue= Integer.parseInt(getPara(0).toString());
		UsersModel u =UsersModel.dao.findById(idValue);
		setAttr("list", u);
		render("/home/detail.html");
	}
}
